import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description: 牛客网.简单题.单词倒序
 */

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        StringBuilder sB = new StringBuilder();
        for(int i = 0; i < s.length(); i++) {
            if(Character.isLetter(s.charAt(i))) {
                sB.append(s.charAt(i));
            }else if(i == 0 || (!Character.isLetter(s.charAt(i - 1)) && (!Character.isLetter(s.charAt(i))))){
                continue;
            }else{
                sB.append(' ');
            }
        }
        String[] result = (sB.toString()).split(" ");
        for(int i = result.length - 1; i >= 0; i--) {
            System.out.print(result[i] + " ");
        }
    }
}

public class Test {
}
